home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 23 / CU Amiga - Super CD-ROM 23 (June 1998).iso / CUCD / Programming / AMOSList / AMOSLIST / sam-stretch.amos / sam-stretch.amosSourceCode
Encoding:
AMOS Source Code  |  1998-04-01  |  844 b   |  48 lines

  1. '
  2. '   Raw sample streching.
  3. '
  4. '   (c) K.Hill, Mar 1998 
  5. '
  6. '
  7. '
  8.  
  9. BANK=10
  10. ' bank=free bank number. 
  11. SR=11000
  12. ' sr=sample rate, it's assuming a raw sample without parsing an iff8svx. 
  13.  
  14. A$=Fsel$("")
  15. Open In 1,A$
  16. SL=Lof(1)
  17. Close 1
  18. ' sl=sample length of first sample 
  19. Reserve As Chip Data BANK,SL
  20. Bload A$,Start(BANK)
  21. Sam Raw 15,Start(BANK),SL,SR
  22.  
  23. ' sl2=sample length of destination sample.  To halve quality,  
  24. ' make it half the sample length of the first one. 
  25. SL2=SL/8
  26. 'SL2=10000 
  27.  
  28. Reserve As Chip Data BANK+1,SL2
  29.  
  30. P1#=Start(BANK)
  31. P2=Start(BANK+1)
  32. IR#=SL/SL2
  33.  
  34. For N=1 To SL2
  35.    Poke P2,Peek(P1#)
  36.    Inc P2
  37.    P1#=P1#+IR#
  38. Next 
  39.  
  40. SR2#=SR/IR#
  41. Sam Raw 15,Start(BANK+1),SL2,SR2#
  42. Print "Original sample length=",SL
  43. Print "Original sample rate=",SR
  44. Print 
  45. Print "New sample length=",SL2
  46. Print "New sample rate=",Int(SR2#)
  47.  
  48. 'Save Fsel$("newsample"),BANK+1